require(['jquery', 'cookie', 'app', 'lay'], function ($) {
    require(['vue'], function (Vue) {
        var dic = new Vue({
            el: ".vue-box"
            , data: {
                where: [],
                that: {

                }
            }
            , created: function () {
                this.seachs();
            }
            , methods: {
                loadPage: function () {
                    var re = playAjax("bsp/7").data;
                    var toolbar = [];
                    toolbar[0] = {
                        "clas": "",
                        "eve": "BIND",
                        "tit": "启用/禁用",
                        "fnc": function (data) {
                            if (data.length == 0) {
                                alr("请选中一行！");
                                return false;
                            } else {
                                var re = playAjax("/UserController/Bind", {uuid:data[0].uuid});
                                alr(re.msg);
                            }
                        }
                    };
                    if(fspuser["role"]=='1'){
                        toolbar[1] = {
                            "clas": "",
                            "eve": "ADD",
                            "tit": "新增业务员",
                            "fnc": function (data) {
                                window.parent.sp.showTab({id: getCode(2), name: '业务员新增', url: './vsp/74'})

                            }
                        };
                    }
                    bspVIEW($(".sa-table"), "/UserController/List", re, this.where, toolbar);
                },
                seachs: function () {
                    this.where = fromName($(".el-form"));
                    this.loadPage();
                },
                referXadmin: function () {
                    window.location.reload();
                },
            }
        });
    })
});
function add(uuid) {
    layer.open({
        type: 2
        , content: "./14"
        , area: ["800px", "400px"]
        , btn: ['确定', '取消']
        , yes: function (index, layero) {
            var body = layer.getChildFrame('body', index);
            var w = $(layero).find("iframe")[0].contentWindow;
            var jon = w.checkSure();
            if(jon==false){
                return false;
            }
            var re=playAjax("/LeaderController/AddUserCity",{users:{uuid:uuid},city:{uuid:jon['uuid']}});
            alr(re.msg);
            setTimeout(function () {
                window.reload();
            },500)

        }
        , btn2: function (index, layero) {
            layer.closeAll();
        }
        , cancel: function () {
            layer.closeAll();
        }
    });
}